import { useUserStore } from '@/pinia/user'
import { getUserInfoMin } from '@api/user'

const userStore = useUserStore()

const updateUserInfo = async () => {
  const userInfo = userStore.userInfo
  if (userInfo) {
    let res = await getUserInfoMin({ userid: userInfo.id })
    res = res.data.data
    userStore.login({
      ...userInfo,
      ...res
    })
  }
}

export { updateUserInfo }
